package org.example.auth.controller;


import org.example.auth.contract.request.LoginRequest;
import org.example.auth.service.LoginService;
import org.example.misc.model.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    private LoginService loginService;

    /**
     * 登录请求返回Token
     */
    @PostMapping("/signIn")
    Result<String> signIn(@RequestBody @Validated LoginRequest request) {
        return Result.ok(loginService.login(request));
    }
}
